package com.ruoyi.web.controller.squad;

import com.alibaba.fastjson2.JSON;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.squadweb.dto.*;
import com.ruoyi.squadweb.service.PlayerInfoService;
import com.ruoyi.squadweb.vo.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.core.parameters.P;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

@RestController
@RequestMapping("/squad/player")
public class PlayerInfoController extends BaseController {
    @Autowired
    private PlayerInfoService playerInfoService;

    /**
     * 查询玩家信息
     *
     * @param playerDTO
     * @return TableDataInfo
     */
    @GetMapping("/gamer/list")
    public TableDataInfo getGamerList(PlayerDTO playerDTO) {
        TableDataInfo tableDataInfo = playerInfoService.getList(playerDTO);

        return getDataTable(tableDataInfo.getRows(), tableDataInfo.getTotal());
    }

    @GetMapping("/team/list")
    public TableDataInfo getTeamList(SquadDTO squadDTO) {
        TableDataInfo tableDataInfo = playerInfoService.getTeamList(squadDTO);

        return getDataTable(tableDataInfo.getRows(), tableDataInfo.getTotal());
    }

    @GetMapping("/kill/list")
    public TableDataInfo getKillList(KillDTO killDTO) {
        TableDataInfo tableDataInfo = playerInfoService.getKillList(killDTO);

        return getDataTable(tableDataInfo.getRows(), tableDataInfo.getTotal());
    }

    @GetMapping("/chat/list")
    public TableDataInfo getChatList(ChatDTO chatDTO) {
        TableDataInfo tableDataInfo = playerInfoService.getChatList(chatDTO);

        return getDataTable(tableDataInfo.getRows(), tableDataInfo.getTotal());
    }

    @GetMapping("/squad/creat/list")
    public TableDataInfo getSquadCreatList(SquadCreateDTO squadCreateDTO) {
        TableDataInfo tableDataInfo = playerInfoService.getSquadCreatList(squadCreateDTO);

        return getDataTable(tableDataInfo.getRows(), tableDataInfo.getTotal());
    }


}
